package com.sz.web.util;

import com.sz.web.common.pojo.ReturnPojo;

/**
 * 数据返回工具类
 */
public class ReturnUtil {

    /**
     * 失败
     * @return
     */
    public static ReturnPojo fail(){
        ReturnPojo returnPojo = new ReturnPojo();
        returnPojo.setSuccess(false);
        returnPojo.setCause("请求失败!");
        return returnPojo;
    }
    /**
     * 失败
     * @return
     */
    public static ReturnPojo fail(String cause){
        ReturnPojo returnPojo = new ReturnPojo();
        returnPojo.setSuccess(false);
        returnPojo.setCause(cause);
        return returnPojo;
    }
    /**
     * 成功
     * @return
     */
    public static ReturnPojo success(){
        ReturnPojo returnPojo = new ReturnPojo();
        returnPojo.setSuccess(true);
        returnPojo.setCause("请求成功!");
        return returnPojo;
    }
    /**
     * 成功
     * @return
     */
    public static ReturnPojo success(Object data){
        ReturnPojo returnPojo = new ReturnPojo();
        returnPojo.setSuccess(true);
        returnPojo.setCause("请求成功!");
        returnPojo.setDatas(data);
        return returnPojo;
    }
}
